package org.september.pisces.task.enums;

import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;

public enum SimpleTaskStatus {

	待运行(0),
    运行中(1),
    锁定中(2),
    已暂停(-1);

    public Integer id;

    SimpleTaskStatus(Integer id) {
        this.id = id;
    }

    public static String getName(Integer id) {
        SimpleTaskStatus[] deviceType = SimpleTaskStatus.values();
        for (SimpleTaskStatus dt : deviceType) {
            if (dt.id.equals(id)) {
                return dt.name();
            }
        }
        return "";
    }

    public static Map<String, Object> getMap() {
        Map<String, Object> map = new LinkedHashMap<>();
        Arrays.asList(SimpleTaskStatus.values()).forEach(deviceType -> {
            map.put(deviceType.id.toString(), deviceType.name());
        });
        return map;
    }

}
